package label_handler

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"peilian-api/app/global/bind"
	"peilian-api/app/services/label_service"
	"peilian-api/utils/format"
)

func CreateLabel(c *gin.Context) {
	var req label_service.CreateLabelReq
	if err := bind.ShouldBinding(c, &req); err != nil {
		format.NewResponseJson(c).Err(30001, err.Error())
		return
	}

	scheme, err := label_service.CreateLabel(c, req)
	if err != nil {
		format.NewResponseJson(c).ErrObj(http.StatusBadRequest, err.Error())
		return
	}
	format.NewResponseJson(c).SuccessObj(scheme)
}
